<%layout("/common/_layout.html"){ %>
  <%#ajax userTable:{%>
  <div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">系统管理</strong> / <small>主题模块配置</small></div>
  </div>
  <form class="am-form" id="list-form" action="${base}/website/list" method="post">
  
  <div class="am-u-sm-12">
      <table class="am-table am-table-bordered am-table-radius table-main">
      <input type="hidden" id="keywords" name="keywords" value='${keywords!""}' />
        <tbody>
          <tr>
            <th class="am-text-middle">网点名称</th>
            <td>
              <div class="am-u-sm-12 am-u-md-12">
                <input type="text" name="class_name" id="class_name" class="am-form-field am-input-sm" value="${class_name!}">
               
              </div>
            </td>
            <td >
                <div align='center'>
                  <button id="search" type="button"  class="am-btn am-btn-default am-btn-sm am-text-secondary">搜索</button>
                </div>
              </td>
          </tr>
        </tbody>
      </table>
    </div>
  
   <div class="am-g">
     <div class="am-u-sm-12 am-u-md-6" style="padding:0px 1.6rem 1.6rem 1rem;margin:0px;">
       <div class="am-btn-toolbar">
         <div class="am-btn-group am-btn-group-xs">
            <%if(so.hasPermission("WEBSITE_ADD")) {%>
           <button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/website/add'"><span class="am-icon-plus"></span> 新增</button>
            <%}%>
         </div>
         <div class="am-btn-group am-btn-group-xs">
            <%if(so.hasPermission("THEMES_AUTH_LIST")) {%>
           <button type="button" class="am-btn am-btn-default" onclick="location.href='${base}/themes/authList'"><span class="am-icon-cog"></span> 按地市、门店、人员授权</button>
            <%}%>
         </div>
       </div>
     </div>
<!--      <div class="am-u-sm-12 am-u-md-3"> -->
<!--        <div class="am-input-group am-input-group-sm"> -->
<!--          <input type="hidden" name="property" value="mobile"/> -->
<!--          <input type="text" class="am-form-field" id="keyword" name="keyword" value="${keyword!}" placeholder="按账号搜索"> -->
<!--          <span class="am-input-group-btn"> -->
<!--            <button  id="searchButton" class="am-btn am-btn-default" type="button">搜索</button> -->
<!--          </span> -->
<!--        </div> -->
<!--      </div> -->
<!--      </div> -->

   <div class="am-g">
     <div class="am-u-sm-12">
        <div class="am-scrollable-horizontal">
         <table class="am-table am-table-striped am-table-hover table-main">
             <thead>
                 <tr class="am-text-nowrap">
                     <th class="table-check"><input type="checkbox"  id="allCheck"/></th><th class="table-title">网点id</th><th class="table-title">名称</th><th class="table-title">类型</th>
                     <%if(so.hasPermission("WEBSITE_EDIT")||so.hasPermission("WEBSITE_AUTH")) {%>
                     <th class="table-title">操作</th>
                     <%}%>
                 </tr>
             </thead>
          <tbody>
             <%for(list in pager.list!){%>
                <tr>
                 <td><input type="checkbox" name="ids" value="${list.id}"></td>
                 <td>${list.WebsiteId}</td>
                  <td>${list.class_name}</td>
                  <td>网点类型</td>
                  <%if(so.hasPermission("WEBSITE_EDIT")||so.hasPermission("WEBSITE_AUTH")) {%>
                  <td>
                      <%if(so.hasPermission("WEBSITE_EDIT")) {%>
                      <a href="${base}/website/edit?edit=1&id=${list.id}">编辑</a>
                      <%}%>
                      <%if(so.hasPermission("WEBSITE_AUTH")) {%>
                          <%if(so.hasPermission("WEBSITE_EDIT")) {%>
                              
                          <%}%>
                      <a href="${base}/website/auth?id=${list.id}&class_name=${list.class_name}">模块授权</a>
                      <%}%>
                  </td> 
                  <%}%>
                    
               </tr>
             <%}%> 
          </tbody>
       </table>
       </div>
        <div class="am-cf">
           <!-- 分页 -->
           <%if (pager.list.~size > 0){%>
               <div class="am-fr">
                   <% include("/admin/common_pager.tpl"){}%>
               </div>
           <%}else{%>
               <div class="am-kai">
                 <h3>没有找到任何记录!</h3>
               </div>
           <%}%>
        </div>
       <%}%>
     </div>
   </div>
 </form>

 <script type="text/javascript">
    $(function(){
      var keywordsObj = {};
      $("#search").on("click",function(){

          keywordsObj.class_name = $("#class_name").val();
        
        var keywords = "";
        if(!$.isEmptyObject(keywordsObj)){
          keywords = JSON.stringify(keywordsObj);
        }
        console.log("dk keywords = "+ keywords);

        $("#pageNumber").val("1");
        $("#keywords").val(keywords);
        $("#list-form").submit();
      });
    });
  </script>
  
<%}%>



